home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17316 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.0 KB  |  41 lines

  1. Path: Belgium.EU.net!news
  2. From: Philip Rademakers <philip@sonytel.be>
  3. Newsgroups: comp.lang.c++
  4. Subject: Templates & friends
  5. Date: Mon, 15 Apr 1996 11:07:11 +0200
  6. Organization: EUnet Belgium, Leuven, Belgium
  7. Message-ID: <317211BF.41C6@sonytel.be>
  8. NNTP-Posting-Host: sclera.sonytel.be
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.01 (X11; I; IRIX 5.3 IP22)
  13.  
  14. Hi,
  15.  
  16. Does anybody know how to declare a friend class that is one of the
  17. argument classes? I tried the following:
  18.  
  19. class X {
  20. protected:
  21.   X();
  22. };
  23.  
  24. template<class T>
  25. class foo {
  26. private:
  27.   T* _ptr;
  28. public:
  29.   friend class T;
  30.   foo() { _ptr = new T; }
  31. };
  32.  
  33. The compiler (on SGI) complains that X::X() is not accessible ?
  34.  
  35. Thanks in advance for your help.
  36. -- 
  37. Philip Rademakers                          Tel: +32 2 724 19 80
  38. Sony Telecom Europe                        Tel: +32 2 724 19 64 (direct)
  39. Sint Stevens Woluwestraat 55               Fax: +32 2 726 26 86
  40. 1130 Brussels - Belgium                    Email: philip@sonytel.be
  41.